<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\AdminController;
use App\Models\Recharge as TRecharge;
use Illuminate\Http\Request;
use App\Models\Agent;

class Recharge extends AdminController{
    
    public function index(Request $req){
        $psize = 15;
        if($req->method() == 'POST'){
            $list = TRecharge::orderBy('id')->paginate($psize);
            foreach ($list as &$v) {
                $v->agent = Agent::where('id',$v->aid)->value('title');
                $v->createtime = date('Y-m-d H:i',$v->createtime);
            }
            wxresp(1, ['rows' => $list->items(), 'total' => $list->total()]);
        }
        return $this->V("index");
    }
}